# -*- coding: utf-8 -*-
from five import grok
from zope import schema
from plone.directives import form
from plone.app.textfield import RichText
from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
from z3c.relationfield.schema import RelationList, RelationChoice
from plone.namedfile.field import NamedImage
from plone.formwidget.contenttree import ObjPathSourceBinder,ContentTreeFieldWidget
from Products.bpContents import _

class IServicio(form.Schema):
    """
    Un Servicio de la biblioteca implementado por un Departamento
    """

    cuerpo = RichText(
      	title=_(u"Cuerpo"),
	    description=_(u"Texto principal"),
        required=False,
    )

    relaciones = RelationList(
        title=_(u"Documentos Relacionados"),
        description=_(u"Otros articulos o galerias que complementen el documento actual"),
        value_type=RelationChoice(
            source=ObjPathSourceBinder(

            ),
        ),
        required=False,
    )


from Acquisition import aq_inner, aq_parent
from plone.directives.dexterity import DisplayForm
from Products.bpContents.BaseClassView import BaseClassView
class View(grok.View):
    grok.context(IServicio)
    grok.require('zope2.View')

    def update(self):
        pass

    def getDamePadre(self):
        """Devuelve el área a la que pertenece el servicio"""

        padre= aq_parent(aq_inner(self.context))


        return padre.Title()